/**
 * @description 面包屑
 */

import { Breadcrumb, Button } from 'antd'
import React from 'react'

import AbIcon from '@/components/DecorateIcons/Ab_Icon'

function BreadWrapper({ showDetail, bread, title2 = '小说列表', title3 = '小说一' }) {

  let base = bread.base
  let breadBase = bread.bread.base

  const breadList1 = [
    {
      href: '#',
      title: <>
        <AbIcon iconName={breadBase.icon} />
        <span>系统首页</span>
      </>,
      onClick: (event) => event.preventDefault()

    },
    {
      href: '#',
      title: title2,
      onClick: (event) => { event.preventDefault(); event.stopPropagation() }
    },
    {
      title: title3
    }
  ]

  const breadList2 = [
    {
      href: '#',
      title: <>
        <AbIcon iconName={breadBase.icon} />
        <span>系统首页</span>
      </>,
      onClick: (event) => event.preventDefault()

    },
    {
      title: title2
    }
  ]

  let items = showDetail ? breadList1 : breadList2


  return (
    <div className='bread-wrapper'>

      {/* 面包屑 */}
      <Breadcrumb
        rootClassName='bread'
        separator={breadBase.text}
        items={items}
      />

      {/* 返回个人中心按钮 */}
      <div className="return-center"><Button className="return-btn">{base.return_text}</Button></div>

    </div>

  )
}
export default React.memo(BreadWrapper)